import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'
import bottomTab from '../components/bottomTab.vue'
import home from '../components/home.vue'
import zhuanti from '../components/zhuanti.vue'
import fenlei from '../components/fenlei.vue'
import shopping from '../components/shopping.vue'
import mine from '../components/mine.vue'
import denglu from '../components/denglu.vue'
import VueRouter from 'vue-router';
import nothingShop from '../components/nothingShop.vue'
import zhuce from '../components/zhuce.vue'

Vue.use(Router)
const routes = [
  // {path:'/',component:shouye},
  {
    path: '/', component: bottomTab, children: [
      { path: '/', component: home, meta: { keepAlive: true } },
      { path: '/home', component: home, meta: { keepAlive: true } },
      { path: '/zhuanti', component: zhuanti, meta: { keepAlive: true } },
      { path: '/fenlei', component: fenlei, meta: { keepAlive: true } },
      { path: '/shopping', component: shopping, meta: { keepAlive: true } },
      { path: '/nothingShop', component: nothingShop, meta: { keepAlive: true } },
      { path: '/mine', component: mine, meta: { keepAlive: true } }
    ], beforeRouteLeave(to, from, next) {
      // 设置下一个路由的 meta
      to.meta.keepAlive = true; // B 跳转到 A 时，让 A 缓存，即不刷新（代码写在B页面）
      next();
    }
  },
  {path:'/denglu',component:denglu,meta: { keepAlive: true }},
  {path:'/zhuce',component:zhuce,meta: { keepAlive: true }}
]

const router = new VueRouter({
  routes
})
export default router
